package basic.time;
//比较
import java.time.*;

public class Demo5 {
    public static void main(String[] args) {
        LocalDate star= LocalDate.of(2024,8,9);
        LocalDate end= LocalDate.of(2024,8,10);

        //计算日期间隔
        Period a=Period.between(star,end);
        System.out.println(a.getDays());

        LocalDateTime A= LocalDateTime.of(2024,8,10,9,28);
        LocalDateTime B= LocalDateTime.of(2024,8,10,20,28);
        Duration c=Duration.between(A,B);
        System.out.println(c.toDays());//距离多少天
        System.out.println(c.toHours());//距离多少小时
        System.out.println(c.toMillis());//分
        System.out.println(c.toSeconds());//秒


    }
}
